Installing Git
Before you can start using Git, you need to install it on your computer. Below are step-by-step instructions for installing Git on Windows, macOS, and Linux.
- Windows
- Mac
- Linux
-
Download Git for Windows
Visit the official Git website and download the installer: 👉 https://git-scm.com/download/win
-
Run the Installer
Open the .exe file you downloaded and follow the setup wizard.
-
Recommended Settings During Installation:
-
Use the default editor (or select one you prefer).
-
Choose "Git from the command line and also from 3rd-party software".
-
Choose HTTPS transport backend: “Use the OpenSSL library”.
-
Line endings: “Checkout Windows-style, commit Unix-style line endings”.
-
-
Verify the Installation Open Command Prompt or Git Bash and run:
git --version
You should see something like git version 2.x.x.
Option 1: Using Homebrew (Recommended)
- Install Homebrew (if you don’t have it):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Git:
brew install git
- Verify Installation:
git --version
Option 2: Install Xcode Command Line Tools
If you have Xcode or run git from the terminal for the first time, macOS may prompt you to install the Command Line Developer Tools:
git --version
If Git is not installed, you will be prompted to install it.
Ubuntu/Debian-based Systems:
- Update Package Index:
sudo apt update
- Install Git:
sudo apt install git
Fedora:
- Install Git:
sudo dnf install git
Arch Linux:
- Install Git:
sudo pacman -S git
Verify Installation:
git --version